//
//$Id: generate.h 722 2012-11-29 17:33:43Z andrew.tsyganov $
#include "contrib/simpleini/SimpleIni.h"
#include "src/heo/include/random.h"
#include "fa.h"

class Generation_Parameters
{
public:
    std::vector<State>  states_;
    std::vector<Symbol> alphabet_;
    double              transition_density_;
    size_t              initial_num_;
    size_t              final_num_;
    size_t              automata_num_;
    std::string         method_;
    std::string         type_;
    bool                inequivalent_; 
    
    Generation_Parameters(CSimpleIniA const &ini, std::string const &section)
    {
        automata_num_       = atoi(ini.GetValue(section.c_str(), "automata_num"));
        initial_num_        = atoi(ini.GetValue(section.c_str(), "initial_num"));
        final_num_          = atoi(ini.GetValue(section.c_str(), "final_num"));
        transition_density_ = atof(ini.GetValue(section.c_str(), "transition_density")); 
        
        size_t n         = atoi(ini.GetValue(section.c_str(), "states_num"));
        std::string pfx  = ini.GetValue(section.c_str(), "states_prefix");
        
        for (size_t i = 0; i < n; ++i)
            states_.push_back(MakeState(pfx, i));
        
        size_t k        = atoi(ini.GetValue(section.c_str(), "alphabet_size"));
        char first_sym  = *(ini.GetValue(section.c_str(), "first_symbol"));
        
        alphabet_.push_back(first_sym);
        for (size_t i = 1; i < k; ++i)
            alphabet_.push_back(alphabet_[i-1]+1);
        
        method_             = ini.GetValue(section.c_str(), "method");
        type_               = ini.GetValue(section.c_str(), "type");
        inequivalent_       = atoi(ini.GetValue(section.c_str(), "inequivalent")) != 0;
    }
};

void GenerateAn(FA& a, Generation_Parameters const& p);
void GenerateLeslieTrim(FA& a, Generation_Parameters const& p, random_generator& rnd);
//void GenerateVanZijl(FA& a, Generation_Parameters const& p, unsigned int const seed);
void GenerateFAs(std::vector<FA>& v_fa, Generation_Parameters const& gp, unsigned int const seed);
//EOF!
